from pcb_manager import PCBManager
from _collections import deque
from main.exceptions.exception import EmptyPCBManagerException

class PCBManagerFIFO(PCBManager):

    def __init__(self):
        self.queue = deque()

    def next(self):
        try:
            return self.queue.popleft()
        except IndexError:
            raise EmptyPCBManagerException

    def add(self,pcb):
        self.queue.append(pcb)

    def has_next(self) :
        return self.queue


